<?php
defined('IN_TS') or die('Access Denied.');

//小组首页

$groupid = intval($_GET['id']);
$typeid = intval($_GET['typeid']);
$isshow = intval($_GET['isshow']);
$usertype = intval($_GET['usertype']);


//小组信息
$strGroup = $new['group']->getOneGroup($groupid);

if($strGroup['groupid'] == '') {
	header("HTTP/1.1 404 Not Found");
	header("Status: 404 Not Found");
	$title = '404';
	include pubTemplate("404");
	exit;
}

$strOpen = explode(',',$strGroup['openday']);
foreach($strOpen as $v){
	if(!$openday){
		$openday = num2day($v);
	}else{
		$openday = $openday.num2day($v);
	}
}

if($strGroup['isaudit'] == 1) {
	tsNotice('内容审核中...');
}
$cover = $strGroup['photo'];
//组长信息
$strLeader = aac('user')->getOneUser($strGroup['userid']);

$isApply = 0;
// 判断会员是否加入该小组
$strGroupUser = '';
if(intval($TS_USER['userid'])){
	$strGroupUser = $new['group']->find('group_user',array(
		'userid'=>intval($TS_USER['userid']),
		'groupid'=>$groupid,
	));
}
//判断用户是否月捐人
$isStockUser = 0;
if(intval($TS_USER['userid'])){
	$isStockUser = $new['group']->findCount('group_user','userid='.intval($TS_USER['userid']).' and groupid='.$groupid.' and isstock<>0');
}
//判断待审会员的人数
if($strGroup['joinway']==2){
	$userAudit=$new['group']->findCount('group_user_isaudit',array(
		'groupid'=>$strGroup['groupid'],
	));
}

//判断是否管理员
if(in_array($TS_USER['userid'],$strGroup['admin'])){
	$isleader = 1;
}

/*小组话题分类

$arrArticleTypes = $new['group']->findAll('article_cate'
);

if(is_array($arrArticleTypes)){
	foreach($arrArticleTypes as $item){
		$arrArticleType[$item['typeid']] = $item;
	}
}*/

//标签
$strGroup ['tags'] = aac ( 'tag' )->getObjTagByObjid ( 'group', 'groupid', $strGroup ['groupid'] );

//把标签作为关键词
if($strGroup['tags']){
	foreach($strGroup['tags'] as $key=>$item){
		$arrTag[] = $item['tagname'];
	}
	$sitekey = $strGroup['groupname'].','.arr2str($arrTag);
}else{
	$sitekey = $strGroup['groupname'];
}


$sitedesc = tsCutContent($strGroup['groupdesc'],50);

if($TS_CF['mobile']) $sitemb = tsUrl('moblie','group',array('ts'=>'show','groupid'=>$strGroup['groupid']));




